const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin}= require('clean-webpack-plugin');

  module.exports = {
    mode: 'development',
    entry: {
      app : './src/index.js'     
    },
   // devtool: 'inline-source-map',
    devServer: {
	  open: true,
      contentBase: './dist'
    },
	module: {
		rules: [
			{
				test: /\.js$/,
				loader: 'babel-loader',
				exclude: path.resolve(__dirname,'node_modules')				
			},
			{
				test: /\.tpl$/,
				loader: 'ejs-loader',
				options: {
					esModule: false
				}
			}
		]
	},
	
    plugins: [    
      new HtmlWebpackPlugin({
             title: 'socket输出'	,
			 template: path.resolve(__dirname,'index.html')
      }),     
	  new CleanWebpackPlugin(),
    ],
    output: {
      filename: 'index.js',
      path: path.resolve(__dirname, 'dist')     
    }
  };